<template>
	<view class="dkfpxq">
<!-- 		<view class="pageTitle">
			<text>代开发票详情</text>
		</view> -->
		<view class="main">
			<view class="title">
				<view class="tm">代开信息确认</view>
			</view>
			<view class="box">
				<view class="item xzk">
					购方信息
				</view>
				<view class="item">
					<view class="name">名称</view>
					<view class="val">{{gmfxx.nsrmc}}</view>
				</view>
				<view class="item">
					<view class="name">纳税人识别号</view>
					<view class="val">{{gmfxx.shxydm}}</view>
				</view>
				<view class="item">
					<view class="name">地址、电话</view>
					<view class="val" v-if="gmfxx.lxdz||gmfxx.lxdh">{{gmfxx.lxdz}} {{gmfxx.lxdh}}</view>
					<view class="val" v-else>-</view>
				</view>
				<view class="item">
					<view class="name">开户行及帐号</view>
					<view class="val">{{gmfxx.yhzh?gmfxx.yhzh:"-"}}</view>
				</view>
			</view>
			<view class="box">
				<view class="item xzk">
					销方信息
				</view>
				<view class="item">
					<view class="name">名称</view>
					<view class="val">{{fpxxData.xfNsrmc}}</view>
				</view>
				<view class="item">
					<view class="name">纳税人识别号</view>
					<view class="val">{{fpxxData.xfNsrsbh}}</view>
				</view>
				<view class="item">
					<view class="name">地址、电话</view>
					<view class="val">{{fpxxData.xfDzdh?fpxxData.xfDzdh:"-"}}</view>
				</view>
				<view class="item">
					<view class="name">开户行及帐号</view>
					<view class="val">{{fpxxData.xfYhzh?fpxxData.xfYhzh:"-"}}</view>
				</view>
			</view>
			<view class="box" v-for="(item,index) in hwxx" :key="index">
				<view class="item xzk">
					开票信息<text v-if="hwxx.length>1"> ({{index+1}})</text>
				</view>
				<view class="item">
					<view class="name">货物及劳务名称</view>
					<view class="val">{{item.hwmc}}</view>
				</view>
				<view class="item">
					<view class="name">金额</view>
					<view class="val">{{item.je}}</view>
				</view>
				<view class="item">
					<view class="name">税率</view>
					<view class="val">{{item.slv}}</view>
				</view>
				<view class="item">
					<view class="name">地址</view>
					<view class="val">{{fpxxData.address}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getYstPreFpxx
	} from "@/utils/common-api.js"
	import commonTools from "@/utils/common-tools.js"
	let xzh = commonTools.getXzq()
	export default {
		name: "dkfpxq",
		data() {
			return {
				sjXzqhsjDm: xzh.xzqhszDm,
				fpxxData: "",
				gmfxx: "",
				hwxx: [],
				paramsVal: "",
			};
		},
		components: {

		},
		onLoad(e) {
			this.paramsVal = JSON.parse(e.data)
			this.handleSearch()
		},
		methods: {
			// 数据查询
			async handleSearch(val) {
				let params = {
					...this.paramsVal,
					sjXzqhsjDm: this.sjXzqhsjDm,
				}
				let res = await getYstPreFpxx(params)
				if (res.body && res.head.errorCode == "0") {
					this.fpxxData = res.body
					this.gmfxx = this.fpxxData.czwDjCzrDTOList[0]
					this.hwxx = this.gmfxx.czwFpMxDTOList
				} else if (res.head.errorCode != "0") {
					uni.showToast({
						title: '数据请求失败',
						icon: 'error',
						duration: 3000
					})
				}
			},
		}
	}
</script>


<style>
	.main {
		padding: 20rpx;
		min-height: 100vh;
	}

	.box {
		margin: 20rpx 0;
		border-radius: 20rpx;
		overflow: hidden;
		border: 1px solid #0000006b;
	}

	.title {
		font-size: 30rpx;
		display: flex;
		justify-content: space-between;
/* 		padding: 20rpx 0 0 0; */
		align-items: center;
		font-weight: bold;
	}

	.item {
		display: flex;
		font-size: 26rpx;
		background-color: #ffffff;
		font-weight: bold;
		padding: 20rpx;
		word-break: break-all;
		align-items: center;
	}

	.xzk {
		font-size: 32rpx;
		word-break: break-all;
		border-bottom: 2rpx solid #0000001a;
	}

	.item>.name {
		text-align: left;
		width: 200rpx;
		margin-right: 20rpx;
		color: #66666699;
	}

	.item>.val {
		text-align: left;

	}

	.btn {
		text-align: center;
		width: 100%;
		padding: 10rpx 0 0 0;
	}



	.btn uni-button {
		width: 590rpx;
		height: 70rpx;
		line-height: 70rpx;

	}
</style>